package com.skyolder.milkbee.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * name 名称
 * rank 等级
 */
@ApiModel(description = "name 名称 rank 等级")
@Entity
@Table(name = "estate")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Estate implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "name")
    private String name;
    
    @Column(name = "rank",updatable=false)
    private Long rank;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public Estate name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    @Column(updatable=false)
    public Long getRank() {
        return rank;
    }

    public Estate rank(Long rank) {
        this.rank = rank;
        return this;
    }

    public void setRank(Long rank) {
        this.rank = rank;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Estate estate = (Estate) o;
        if (estate.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, estate.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Estate{" +
            "id=" + id +
            ", name='" + name + "'" +
            ", rank='" + rank + "'" +
            '}';
    }
    public static List<Estate> initAll(){
    	List<Estate> list=new ArrayList<Estate>();
    	{
    		Estate estate=new Estate();
    		estate.setName("佃农");
    		estate.setRank(0L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("贫农");
    		estate.setRank(1L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("中农");
    		estate.setRank(2L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("富农");
    		estate.setRank(3L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("地主");
    		estate.setRank(4L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("乡绅");
    		estate.setRank(5L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("乡望");
    		estate.setRank(6L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("名望");
    		estate.setRank(7L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("伯侯");
    		estate.setRank(8L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("国公");
    		estate.setRank(9L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("郡王");
    		estate.setRank(10L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("亲王");
    		estate.setRank(11L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("九千岁");
    		estate.setRank(12L);
    	}
    	{
    		Estate estate=new Estate();
    		estate.setName("皇帝");
    		estate.setRank(13L);
    	}
    	return list;
    	
    }
}
